<!--
 * @Author: NaturalHulk 2066634567@qq.com
 * @Date: 2024-02-19 15:56:28
 * @LastEditors: NaturalHulk 2066634567@qq.com
 * @LastEditTime: 2024-04-02 18:05:18
 * @FilePath: /hanchuan-272-web/src/components/p-components/p-importList/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->

<script setup>
const { proxy } = getCurrentInstance();
const props = defineProps({
  //列表数据
  list: {
    type: Array,
    default: () => [],
  },
  //枚举列表
  column: {
    type: Array,
    default: () => [],
  },
  //弹窗状态
  isShow: {
    type: Boolean,
    default: false,
  },
  //弹窗标题
  title: {
    type: String,
    default: "",
  },
  //传入的数据
  data: {
    type: Object,
    default: () => {},
  },
});

//分页参数
const query = reactive({
  pageNum: 1,
  pageSize: 10,
});

//使用inject接收爷组件发送的数据,假如没有就用后面的路径
const urls = inject("url", "11"); //导入列表接口
const reporturlList = inject("reporturlList"); //报表导入列表接口
const nums = inject("num"); //从爷爷组件传来的num 判断导入还是报表导入
const emit = defineEmits([
  "selectsubmit",
  "preservation",
  "cancel",
  "reset",
  "uziTypeChange",
]);

//导出错误信息
const isUpload = () => {
  console.log(props.data, " props.data");
  let str = JSON.stringify(props.data);

  proxy.download(urls, { requestId: props.data.requestId });
};
</script>
<template>
  <!-- 查询条件 -->
  <p-dialog
    :isBtn="false"
    v-model="props.isShow"
    :title="props.title"
    @close="emit('cancel')"
    width="50%"
  >
    <!-- <table align="center" class="item">
      <body class="tableItem">
        <tr class="item-top">
          <th>导入总条数</th>
          <th>成功条数</th>
          <th>失败条数</th>
          <th>错误信息</th>
        </tr>
        <tr>
          <th>{{ props.data.total }}</th>
          <th>{{ props.data.successTotal }}</th>
          <th>{{ props.data.errorTotal }}</th>
          <th>
            <el-link
              v-if="props.data.errorTotal > 0"
              type="danger"
              @click="isUpload"
              >下载错误信息</el-link
            >
          </th>
        </tr>
      </body>
    </table> -->
    <!-- <div>
      <span>注：</span>
      <span style="color: red"
        >出现错误信息时，可点击"下载错误信息"导出错误信息excel表格</span
      >
    </div> -->
  </p-dialog>
</template>

<style scoped lang="scss">
.Btn {
  margin-top: 10px;
  float: right;
}
.item {
  border-collapse: collapse;
  border-top: 1px solid #dfe6ec;
  border-left: 1px solid #dfe6ec;
  margin: auto;
  margin-bottom: 15px;

  tr th {
    background-color: #f7f7f8;
    padding: 6px;
    text-align: center;
    border-bottom: 1px solid #dfe6ec;
    border-right: 1px solid #dfe6ec;
    // line-height: 2rem; //编写行高使撑开每行间距
    td:nth-child(1) {
      text-align: center; //文字内容居中
    }
    td:nth-child(3) {
      text-align: center; //文字内容居中
    }
  }
  .tableItem {
    width: 100%;
    overflow: hidden;
    .item-top {
      width: auto;
      background-color: #f7f7f8;
      th {
        width: 120px;
      }
    }
  }
}
</style>
